<?php	$p=permissionController::singleton(); ?>
<div id="page">

<div id="content">

<form action=<?php echo BASE_PATH;?>Studente/View_search/ method='get'>

<label>Cerca Studente:</label>
<br>
<select class="s" name="ricerca" id="ricerca">
<option value="all">Tutti</option>
<option value="corso">Corso di studio</option>
<option value="matricola">Matricola</option>
<option value="nc">Nome Cognome</option>
</select>

<input type="submit" value="Cerca">
<input type="text" name="data" id="data" size="9"/>
 </form>
 
 <br>
 <br>
 
	<table>

			<th>Matricola</th>
			<th>Cognome</th>
			<th>Nome</th>
			<th>Data di Nascita</th>
			<th>Anno di <br>Immatricolazione</th>
			<th>Email</th>
			<?php 
			$uri['controller']="Studente";
			$uri['method']="Update_openViewUpadateStudente";
			if($p->permission($uri)){ ?>
			<th>Modifica</th>
			<?php }?>
			<?php 
			$uri['controller']="Studente";
			$uri['method']="Delete_Studente";
			if($p->permission($uri)){ ?>
			<th>Cancella</th>
          <?php }?>
		<?php

		foreach ($vars as $result){
			echo "<tr>
					<td >"
					.$result[Matricola]."
					</td>
					<td >"
					.$result[Cognome]."
					</td>
					<td >"
					.$result[Nome]."
					</td>
					<td>"
					.$result['Data di nascita']."
					</td>
					<td >"
					.$result['Anno immatricolazione']."
					</td>
					<td>"
					.$result[Email];
					
			$uri['controller']="Studente";
			$uri['method']="Update_openViewUpadateStudente";
			if($p->permission($uri)){ 
					echo"</td>
					<td>
						<a href='".BASE_PATH."Studente/Update_openViewUpadateStudente/?matricola=".$result[Matricola]."'>
							<img src='".BASE_PATH."application/view/image/modifica.jpg' border='0'>
						</a>
					</td>";
					}
					$uri['controller']="Studente";
					$uri['method']="Delete_Studente";
			if($p->permission($uri)){ 
					echo "<td>
						<a  href='".BASE_PATH."Studente/Delete_Studente/?matricola=".$result[Matricola]."'>
							<img src='".BASE_PATH."application/view/image/esci.png' border='0'>
						</a>
					</td>";
			}
				echo"</tr>";
		}

	?>
</table>
<br>

</div>
</div>
